<?php
/**
 * 园所角色model
 */
class Nursery_role_model extends CT_Model
{
	public $_table = 'nursery_role';
	
	public function __construct()
	{
		parent::__construct();
		$this->load->database();
	}


	//判断角色名称是否重复
	public  function  check_role_name($role_name,$role_id=NULL){

		if(empty($role_id)){
			$this->db->where('name',$role_name);
		}else{
			$this->db->where('id <>',$role_id);
			$this->db->where('name',$role_name);
		}

		$data = $this->db->select('id')->get($this->_table)->row_array();
		return $data['id'];

	}
	
}